import "./engine.patch";

function d(o, k, v) {
    Object.defineProperty(o, k, {
        value: v,
        writable: false,
        configurable: false
    })
}

(function (prototype) {
    d(prototype, "remove", function (elm) {
        let index = this.indexOf(elm);
        if (index === -1) return false;
        this.splice(index, 1);
        return true;
    });

    d(prototype, "removes", function (...elms) {
        elms.forEach(this.remove, this)
    });

    d(prototype, "pushOnce", function (elm) {
        if (this.indexOf(elm) === -1) {
            this.push(elm);
            return true;
        }

        return false;
    })

    d(prototype, "pushOnces", function (...elms) {
        elms.forEach(this.pushOnce, this);
    })



})(Array.prototype);

